<template>
  <div v-if="props.menuList.length !== 0">
    <template v-for="item in props.menuList" :key="item">
      <el-sub-menu v-if="item.type === 0" :index="(item.menu_id)" >
        <template #title>
          <el-icon><component :is="item.icon"></component></el-icon>
          <span style="margin-left: 10%;">{{ item.menu_name }}</span>
        </template>
        <Menu :menu-list="item.children"></Menu>
      </el-sub-menu>
      <el-menu-item v-if="item.type === 1" :index="item.path">
        <el-icon><component :is="item.icon"></component></el-icon>
        <span style="margin-left: 10%;">{{ item.menu_name }}</span>
      </el-menu-item>
    </template>
  </div>
</template>

<script setup>
import Menu from "./Menu.vue";
const props = defineProps({
  menuList: Array,
});
</script>

<style scoped>
</style>